$(function(){
	var userName = sessionStorage['username'];
	if(userName==null||userName==""){
		$(window).mobileMsgBox({msgText:"请先登录",delayTime:1000});
		window.location="login.html#loginPage";
	}
	$("#orderGrid").mobileGrid({pageSize:5,currentPageIndex:1,userId:sessionStorage['userId'],server:localStorage['APP_AJAX_PATH']+"/drinkingBar/view/orderSearch.jsp.findOrder"});
	 $("tbody tr").each(function(index, dom){
		 $(dom).attr("onclick","toDetail("+index+")");
	 });
	 $("#home").bind("tap",toHome);
	 
});

function toDetail(index){
	var orderId = $("#orderGrid").record(index).id;
	androidLocal({"orderId":orderId});
	window.location="orderDetailSearch.html";
}

function toHome(){
	window.location = "main.html";
}
var androidLocal=function(p){
	for(var k in p){
		sessionStorage[k]=p[k];
	}
}